@echo off
REM 完整的编码解决方案
REM 设置控制台代码页为UTF-8
chcp 65001 >nul 2>&1
REM 设置Python环境变量
set PYTHONIOENCODING=utf-8
set PYTHONUTF8=1
echo ============================================
echo DXF镜像工具 - 依赖安装脚本
echo DXF Mirror Tool - Dependency Installation
echo ============================================
echo.

REM 检查Python是否已安装
python --version >nul 2>&1
if errorlevel 1 (
    echo 错误：未检测到Python，请先安装Python 3.x
    echo Error: Python not detected, please install Python 3.x first
    echo.
    echo 请访问 https://www.python.org/downloads/ 下载并安装Python
    echo Please visit https://www.python.org/downloads/ to download and install Python
    goto end
)

echo 检测到Python版本:
echo Detected Python version:
python --version
echo.

REM 升级pip
echo 正在升级pip...
echo Upgrading pip...
python -m pip install --upgrade pip
echo.

REM 检查requirements.txt是否存在
if not exist "requirements.txt" (
    echo 错误：未找到requirements.txt文件
    echo Error: requirements.txt file not found
    goto end
)

REM 安装requirements.txt中的依赖
echo 正在安装requirements.txt中的依赖...
echo Installing dependencies from requirements.txt...
python -m pip install -r requirements.txt
echo.

echo ============================================
echo 依赖安装完成！
echo Dependencies installation completed!
echo ============================================
echo.

:end
echo 按任意键退出...
echo Press any key to exit...
pause >nul